<template>
	<view class="content pb20" v-if="data != ''">
		<u-navbar :title="title" :is-back="false"></u-navbar>
		<view class="" style="box-shadow:0rpx 6rpx 10rpx -8rpx #666;">
			<!-- <u-swiper :list="data.banner" ></u-swiper> -->
			<swiper class="swiper" :indicator-dots="true" :autoplay="true" style="height: 500rpx;" interval="2000" :circular="true" >
				<swiper-item v-for="(item,index) in data.banner" :key="index" >
					<image :src="item" mode="widthFix" style="width: 100%;"></image>
				</swiper-item>
			</swiper>
		</view>
		<view class=" dis-flex flex-align-center flex-center c-fff" style="" >
			<image src="../../static/titel2.png" mode="" style="width: 100%;height: 140rpx;"></image>
			<view class="pos-abs center" >服务优势</view>
		</view>
		<view class="" style="">
			<!-- <view class="center fs18 fw600" v-if="suo1==0" style="height: 200rpx;line-height: 200rpx;">
				加载中...
			</view> -->
			<image  class=" wd100" :src="data.fwys" @load="wanbi1" mode="widthFix"  style=""></image>
		</view>
		<view class=" dis-flex flex-align-center flex-center " style="background-color: #00aeff;color: #00aeff;box-shadow:0rpx 6rpx 10rpx -8rpx #666 inset;">
			<image src="../../static/titel.png" mode="" style="width: 100%;height: 140rpx;"></image>
			<view class="pos-abs center" >专业检测仪器</view>
		</view>
		<view class=""  style="background-color: #00aeff;box-shadow:0rpx 6rpx 10rpx -8rpx #666;height: 100%;">
			<!-- <view class="center fs18 fw600" v-if="suo2==0" style="height: 200rpx;line-height: 200rpx;">
				加载中...
			</view> -->
			<image  class=" wd100" :src="data.jcyq" @load="wanbi2"  mode="widthFix" style=""></image>
		</view>
		<view class=" dis-flex flex-align-center flex-center c-fff" >
			<image src="../../static/titel2.png" mode="" style="width: 100%;height: 140rpx;"></image>
			<view class="pos-abs center" >检测项目</view>
		</view>
		<view class="" style="">
			<!-- <view class="center fs18 fw600" v-if="suo3==0" style="height: 200rpx;line-height: 200rpx;">
				加载中...
			</view> -->
			<image  class=" wd100" :src="data.jcxm" @load="wanbi3" mode="widthFix"  style=""></image>
		</view>
		<view class=" dis-flex flex-align-center flex-center " style="background-color: #00aeff;color: #00aeff;box-shadow:0rpx 6rpx 10rpx -8rpx #666 inset;">
			<image src="../../static/titel.png" mode="" style="width: 100%;height: 140rpx;"></image>
			<view class="pos-abs center" >服务流程</view>
		</view>
		<view class="pr20 pl20 pb20" style="background-color: #00aeff;box-shadow:0rpx 6rpx 10rpx -8rpx #666;height: 100%;">
			<!-- <view class="center fs18 fw600" v-if="suo4==0" style="height: 200rpx;line-height: 200rpx;">
				加载中...
			</view> -->
			<image  class=" wd100" :src="data.fwlc" @load="wanbi4" mode="widthFix" style=""></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data:[],
				title:'一检验车',
				list: [{
						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
					}
				],
				suo1:0,
				suo2:0,
				suo3:0,
				suo4:0
			}
		},
		onLoad() {
			uni.showLoading({
			    title: '加载中...'
			});
			this.init()
			this.auth()
			//打开分享
			uni.showShareMenu()
		},
		methods: {
			init(){
				//获取页面团
				this.$http.post(this.$config.UrlPostimagesList, {}).then((res) => {
					if (res.status == 1) {
						this.data = res.data
					} 
				})
			},
			auth(){
				var that = this
				// 登陆类型/服务商
				uni.getProvider({
					service: 'oauth',
					success: function(Servres) {
						console.log('获取服务商', Servres);
						var provider = Servres.provider[0]
						// 获取code 用于获取openID和unionID
						uni.login({
							provider: provider,
							success: function(loginRes) {
								console.log('获取code', loginRes);
								var json = {
									code: loginRes.code,
								}
								that.$http.post(that.$config.UrlPostlogin, json).then((res) => {
									if (res.status == 1) {
										uni.setStorageSync('uid', res.data.userId);
									} else {
										that.$api.toast(res.msg);
									}
								})
				
							}
						})
					}
				});
			},
			goxiaoxi(){
				this.$api.openWindow("/pages/push/push")
			},
			wanbi1(e){
				this.suo1 = 1
				if(this.suo1 && this.suo2 && this.suo3 && this.suo4){
					uni.hideLoading();
				}
			},
			wanbi2(e){
				this.suo2 = 1
				if(this.suo1 && this.suo2 && this.suo3 && this.suo4){
					uni.hideLoading();
				}
			},
			wanbi3(e){
				this.suo3 = 1
				if(this.suo1 && this.suo2 && this.suo3 && this.suo4){
					uni.hideLoading();
				}
			},
			wanbi4(e){
				this.suo4 = 1
				if(this.suo1 && this.suo2 && this.suo3 && this.suo4){
					uni.hideLoading();
				}
			}
		}
	}
</script>

<style>
page {
		background: #ffffff;
		color: #333333;
	}

</style>
